package petertel.pbx.utils;

public class ConfigFile extends ConfigItem {

	public ConfigFile(String[] lines, int startx, int endx) {
		int start = -1, end = 0;
		for (; end < lines.length; end++) {
			String line = lines[end];
			if (!ParserUtils.isSection(line)) {
				continue;
			}
			if (start >= 0 && start < end) {
				parseSection(lines, start, end);
			}
			start = end;
		}
		parseSection(lines, start, end);
	}

	private void parseSection(String[] lines, int start, int end) {
		ConfigSection csection = new ConfigSection(lines, start, end);
		addChild(csection);
	}

}
